package com.kexin.student.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.kexin.common.annotation.Log;
import com.kexin.common.core.controller.BaseController;
import com.kexin.common.core.domain.AjaxResult;
import com.kexin.common.enums.BusinessType;
import com.kexin.student.domain.StuBj;
import com.kexin.student.service.IStuBjService;
import com.kexin.common.utils.poi.ExcelUtil;
import com.kexin.common.core.page.TableDataInfo;

/**
 * 专转本班级Controller
 * 
 * @author ruoyi
 * @date 2025-04-21
 */
@RestController
@RequestMapping("/student/banji")
public class StuBjController extends BaseController
{
    @Autowired
    private IStuBjService stuBjService;

    /**
     * 查询专转本班级列表
     */
    @PreAuthorize("@ss.hasPermi('student:banji:list')")
    @GetMapping("/list")
    public TableDataInfo list(StuBj stuBj)
    {
        List<StuBj> list = stuBjService.selectStuBjList(stuBj);
        return getDataTable(list);
    }

    /**
     * 导出专转本班级列表
     */
    @PreAuthorize("@ss.hasPermi('student:banji:export')")
    @Log(title = "专转本班级", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, StuBj stuBj)
    {
        List<StuBj> list = stuBjService.selectStuBjList(stuBj);
        ExcelUtil<StuBj> util = new ExcelUtil<StuBj>(StuBj.class);
        util.exportExcel(response, list, "专转本班级数据");
    }

    /**
     * 获取专转本班级详细信息
     */
    @PreAuthorize("@ss.hasPermi('student:banji:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(stuBjService.selectStuBjById(id));
    }

    /**
     * 新增专转本班级
     */
    @PreAuthorize("@ss.hasPermi('student:banji:add')")
    @Log(title = "专转本班级", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody StuBj stuBj)
    {
        return toAjax(stuBjService.insertStuBj(stuBj));
    }

    /**
     * 修改专转本班级
     */
    @PreAuthorize("@ss.hasPermi('student:banji:edit')")
    @Log(title = "专转本班级", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody StuBj stuBj)
    {
        return toAjax(stuBjService.updateStuBj(stuBj));
    }

    /**
     * 删除专转本班级
     */
    @PreAuthorize("@ss.hasPermi('student:banji:remove')")
    @Log(title = "专转本班级", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(stuBjService.deleteStuBjByIds(ids));
    }
}
